import request from '@/router/axios';

export const getUserTree = () => {
    return request({
      url: '/api/user-api/mx-org/tree',
      method: 'get',
      params: {}
    })
  }

  export const addUser = (data) => {
    return request({
      url: '/api/user-api/mx-user/save',
      method: 'post',
      data,
    })
  }
  export const updateUser = (data) => {
    return request({
      url: '/api/user-api/mx-user/update',
      method: 'post',
      data,
    })
  }

  export const getUserList = (params) => {
    return request({
      url: '/api/user-api/mx-user/page',
      method: 'get',
      params
    })
  }
  export const getUserListData = (params) => {
    return request({
      url: '/api/user-api/mx-user/getUserListByOrg',
      method: 'get',
      params
    })
  }

  export const delUser = (params) => {
    return request({
      url: '/api/user-api/mx-user/delete',
      method: 'get',
      params:{...params}
    })
  }
  export const getRoleList = (params) => {
    return request({
      url: '/api/user-api/mx-role/list',
      method: 'get',
      params:{...params}
    })
  }
  export const getUserGroupList = (params) => {
    return request({
      url: '/api/user-api/mx-user-group/getAllAppList',
      method: 'get',
      params:{...params}
    })
  }
  export const batchDelUser = (data) => {
    return request({
      url: '/api/user-api/mx-user/batch-delete',
      method: 'post',
      data,
    })
  }
  export const updatePassword = (data) => {
    return request({
      url: '/api/user-api/mx-user/update-password',
      method: 'post',
      data,
    })
  }
  export const updateLockFlag = (data) => {
    return request({
      url: '/api/user-api/mx-user/update-lockflag',
      method: 'post',
      data,
    })
  }

  export const detail = (params) => {
    return request({
      url: '/api/user-api/mx-user/detail',
      method: 'get',
      params: {...params}
    })
  }

  export const allocateApplication = (params) => {
    return request({
      url: '/api/user-api/mx-user/allocateApplication',
      method: 'post',
      params: {...params}
    })
  }

  // 上传用户表格
export const uploadUser = (formData) => {
  return request({
      headers: {
          "Content-Type": "multipart/form-data"
        },
      url: '/api/file-api/mx-file/importExcel',
      method: 'post',
      data:formData

  })
}

  // 上传用户表格
export const importUser = () => {
  return request({
      url: '/api/user-api/mx-user/import-template',
      method: 'get',
      responseType:"blob"
  })
}
